const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const TestPlugin = require('./testPlugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = {
    mode:'development',
    devtool:false,
    entry: {
        page1:'./src/page1.js',
        page2:'./src/page2.js',
    },
    output:{
        filename:'[name].[chunkhash].js',
        path:path.resolve(__dirname,'dist'),
    },
    devServer:{
        hot:true,//支持热更新
        port:8080,
        static: {
            directory: path.resolve(__dirname,'static')
          },
          devMiddleware: {
            writeToDisk: true,
          },
    },
    plugins:[
        new HtmlWebpackPlugin({
            template:'./public/index.html'
        }),
        new TestPlugin(),
        new CleanWebpackPlugin(),
    ],
    optimization: {
        // minimize: false,
        // runtimeChunk: "single",
    },

}